<table> 
<tr>
  <th><b>Name:</b></th>
  <td><%= @event.name %></td>
</tr>
<tr>
  <th><b>Owner:</b></th>
  <td><%= link_to @event.owner.username, @event.owner %></td>
</tr>
<tr>
  <th><b>Description:</b></th>
  <td><%= @event.description %></td>
</tr>
<tr>
  <th><b>Event Type:</b></th>
  <td><%= Event::TYPE_NAMES[@event.event_type] %></td>
</tr>
<tr>
  <th><b>Event Duration:</b></th>
  <% if @event.duration_type == Event::MULTI_DAY %>
    <td><%= pluralize(@event.duration, 'day')%></td>
  <% else %>
    <td><%= Event::DURATION_NAMES[@event.duration_type] %></td>
  <% end %>
</tr>

<% if [Event::AM, Event::PM, Event::FULL_DAY].include?(@event.event_type) %>
  <tr>
    <th><b>Day of Event</b></th>
    <td><%= @event.begin_date %></td>
  </tr>
<% else %>
  <tr>
    <th><b>Start at:</b></th>
    <td><%= @event.start_at.to_formatted_s(:short) %></td>
  </tr>
  <tr>
    <th><b>End at:</b></th>
    <td><%= @event.end_at.to_formatted_s(:short) %></td>
  </tr>
<%end %>
<tr>
  <th><b>Created at:</b></th>
  <td><%= @event.created_at.to_formatted_s(:short) %></td>
</tr>
<tr>
  <th><b>Updated at:</b></th>
  <td><%= @event.updated_at.to_formatted_s(:short) %></td>
</tr>
<tr>
  <th><b>Creator:</b></th>
  <td><%= link_to @event.creator.username, @event.creator%></td>
</tr>
<tr>
  <th><b>Approved:</b></th>
  <td><% display_true_false_field(@event.approved, {:centered => false }) %></td>
</tr>
<tr>
  <th><b>Approver:</b></th>
  <% if @event.approved && !@event.approver.nil? %>
    <td><%= link_to @event.approver.username, @event.approver %></td>
  <% else %>
    <td> </td>
  <% end %>
</tr>
</table>

<%= link_to 'Edit', edit_event_path(@event) %> |
<%= link_to 'Back', events_path %>

<% if @approvable && !@event.approved %>
  | <%= link_to 'Approve', approve_event_path(@event) %>
<% elsif @approvable && @event.approved %>  
  | <%= link_to 'Revoke Approval', revoke_approval_event_path(@event) %>
<% end %>
